package edu.gatech.fiveminutesleft.storage;

/**
 * A specific type of Storage object that contains account information and is
 * stored on the local device. Data stored in this object is assumed to be
 * private to the application.
 * 
 * @author Nick Johnson
 */
public interface LocalStorage extends Storage {

	/**
	 * Attempt to find the account with the given username within this storage.
	 * 
	 * @param username - The username.
	 * @return a reference to the found account on success, null on error.
	 */
	AccountReference getAccount(String username);
	
	/**
	 * Attempt to create a new account within this storage.
	 * 
	 * @param username - The new username for the account.
	 * @return a reference to the found account on success, null on error.
	 */
	AccountReference createAccount(String username);
	
	/**
	 * Attempt to find the username with the given email address within this storage.
	 * 
	 * @param email The email address
	 * @return a reference to the found username on success, null on error.
	 */
	EmailReference getEmail(String email);
	
	/**
	 * Attempt to create a new username within this storage bound to the given email address.
	 * 
	 * @param email The email address
	 * @return a reference to the new account on success, null on error.
	 */
	EmailReference createEmail(String email);
	
	/**
	 * Remove all local storage data.
	 */
	void delete();
	
}